package com.elevator;

import java.awt.Dimension;
import java.util.Vector;

import javax.swing.JButton;
import javax.swing.JPanel;

import data.setting;

public class manualView extends JPanel {
    private static final long serialVersionUID = 1L;
    public Vector<elevatorViews> mElevatorViews = new Vector<elevatorViews>();
	public JButton mBackBtn = new JButton("Back");
	
	public manualView()
	{
		this.setLayout(null);
		createpanel();
	}
	public void createpanel()
	{
		for (int i = 0; i < mElevatorViews.size(); i++) {
			this.remove(mElevatorViews.get(i));
		}
		mElevatorViews.clear();

		for (int i = 0; i < setting.sEvelatorCount; i++) {
			elevatorViews view1 = new elevatorViews();
			this.add(view1);
			view1.setLocation(300*i, 50);
			mElevatorViews.add(view1);
			view1.startTimer();
		}
		this.add(mBackBtn);
		mBackBtn.setBounds(120, 10, 80, 30);
		this.setPreferredSize(new Dimension(setting.sEvelatorCount*300, mElevatorViews.get(0).getSize().height+50));
	}
	public void stopTimer() {
		// TODO Auto-generated method stub
		for (int i = 0; i < mElevatorViews.size(); i++) {
			mElevatorViews.get(i).StopTimer();
		}
	}
}
